A system for processing information can include a system memory. Moreover, one or more devices of the system can include a cache memory. A cache memory is a relatively small high-speed memory that stores a copy of information from one or more portions of the system memory. Normally, the cache memory is physically distinct from the system memory, and each device manages the state of its respective cache memory.
A device can copy information from a portion of the system memory into the device's cache memory. The device can modify information in its cache memory. Further, the device can copy modified information from its cache memory back to a portion of the system memory.
According to one technique, the cache memory is logically arranged into multiple sets. Normally, the cache memory is smaller than the system memory, and a limit is imposed on the maximum amount of information physically stored in a set at any single moment. If a set is storing the maximum amount of information, then at least some information in the set is replaced when different information is copied from the system memory into the set.
In a coherent memory system, all devices operate in response to the most recent version of information for the system memory. Such coherency allows synchronization, cooperative use of shared resources, and task migration among the devices. Accordingly, if replaced information is modified relative to an original version of the information stored within the system memory at the same physical address, the device (that includes the cache memory) updates the system memory by copying the modified information from the cache memory to the same physical address within the system memory.
With previous techniques, a device's cache memory operates inefficiently in certain situations where information is replaced in the cache memory. For example, with previous techniques, there is a high likelihood in certain situations that replaced information (1) will be modified relative to an original version of the information stored within the system memory and therefore will be copied from the cache memory to the system memory and (2) subsequently will be requested by the device and therefore will be copied again from the system memory into the cache memory. By repeatedly copying information back-and-forth between the cache memory and system memory in this manner, traffic is added through the system bus, and overall performance of the system is degraded.
Thus, a need has arisen for a method and system for storing information in a cache memory, in which the cache memory operates more efficiently relative to previous techniques.